<template>
    <div id="myChart" :style="{width: '800px', height: '600px'}"></div>
</template>
<script>

    import axios from 'axios'
    export default {
        name: 'Echarts',
        mounted(){
            let _this=this
            axios.get('http://localhost:8888/anime/animeRating').then(function (response) {
                // 基于准备好的dom，初始化echarts实例
                let myChart = _this.$echarts.init(document.getElementById('myChart'))
                // 绘制图表
                myChart.setOption({

                    xAxis: {
                        type: 'category',
                        // data: ['9.9', '9.8', '9.7', '9.6', '9.5', '9.4', '9.3','9.2','9.1','9.0']
                        data: response.data.scoreList
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [{
                        // data: [120, 200, 150, 80, 70, 110, 130,65,100,25],
                        data: response.data.numList,
                        type: 'bar'
                    }]
                });
            })

        }
    }
</script>